package com.gosophia.conference.action.confPrepare;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.conferenceManagement.confPreparation.ws.ConfPreparationWebService;
import com.gosophia.oa.action.JudgeCurrentUndertaker;
import com.gosophia.springsecurity.UserDetailsImpl;
/**
 * 完成会务准备
 * @author wangxinbing
 * @since  2011-4-6
 *  Copyright (c) 2010 Gosophia corporation All Rights Reserved
 */
@Component("AccomplishConferencePreparationAction")
@Scope("prototype")
public class AccomplishConferencePreparationAction extends BaseSupportAction{

	@Autowired
	private ConfPreparationWebService confPreparationWebService;
	@Autowired
	private JudgeCurrentUndertaker judgeCurrentUndertaker;
	
	private Long jobId;
	
	private String fromFlag;
	@Override
	public String _execute() throws Exception {
		UserDetailsImpl userDetails = (UserDetailsImpl) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        Long operatorId = userDetails.getUserAccountDTO().getUserInfoDTO().getUserInfoId();
        //判断是否匹配,如果不匹配转到异常页面
        judgeCurrentUndertaker.judgeOperationAuthority(jobId);
		confPreparationWebService.accomplishConferencePrepare(jobId,operatorId,null);
		if("task".equalsIgnoreCase(fromFlag)){
			return "TODOJOBPAGE";
		}
		return SUCCESS;
	}
	public Long getJobId() {
		return jobId;
	}
	public void setJobId(Long jobId) {
		this.jobId = jobId;
	}
	public String getFromFlag() {
		return fromFlag;
	}
	public void setFromFlag(String fromFlag) {
		this.fromFlag = fromFlag;
	}
	
	

}
